<?php

class View
{
	private $registry;
	private $vars = array();
	
	function __construct($registry)
	{
		$this->registry = $registry;
	}
	
	public function __set($index, $value)
	{
		$this->vars[$index] = $value;
	}

	/**
	*
	* @Call the view
	*
	* @param $name - name of the view file
	*
	* @return void
	*
	*/
	function show($name)
	{
		if (__MODULE == 'true') {
			$path = __SITE_PATH . '/' . $name . '/views/' . $name . '.php';
		} else {
			$path = __SITE_PATH . '/views/' . $name . '.php';
		}
		if (file_exists($path) == false) {
			throw new Exception('View not found in: ' . $path);
			return false;
		}
		foreach($this->vars as $key => $value)
		{
			$$key = $value;
		}
		include($path);
	}
}

?>